home *** CD-ROM | disk | FTP | other *** search
/ IRIX 6.4 Applications 1997 August / SGI IRIX 6.4 Applications 1997 August.iso / dist / mmailp.idb / usr / lib / Zmail / samples / zscript / bounce.zsc.z / bounce.zsc
Encoding:
Text File  |  1997-01-22  |  1007 b   |  26 lines

  1. # Sample Z-Script function: bounce
  2. #                 button:   Bounce
  3.  
  4. function bounce() {
  5.     #%
  6.     # Often, you send mail and mistype an address or something and it causes
  7.     # a "mailer daemon" to return your mail with an error like "host unknown"
  8.     # or "unknown user".  The "bounce" function (below) extracts your original
  9.     # message from the mailer-daemon and allows you to edit it again, if it
  10.     # needs it.  Otherwise, you can just send it again.
  11.     #%
  12.     if $(%t) == 0   # a convenient way to see if there are any messages.
  13.         echo No messages.
  14.         return -1
  15.     endif
  16.     # use the message specified ($1), if given.  Else, use the "current msg".
  17.     Pipe -p From: $1 "cat > $tmpdir/bnc$$"
  18.     if ! -z $tmpdir/bnc$$
  19.     # mail -u means "send unsigned" so it won't autosign the message
  20.     # this assumes you've already signed it the first time you sent it.
  21.         mail -u -h $tmpdir/bnc$$   # use the tmpfile as a template
  22.     endif
  23.     sh rm $tmpdir/bnc$$
  24. }
  25. button -n Bounce bounce
  26.